<style type="text/css">
	div.app-list{
		position:absolute;
		top:1.111rem;
		bottom:0;
		font-size:0;
		left:0;
		width:100%;
	}
	ul.app-list{
		font-size:0;
		width:100%;
		height:25%;
		text-align:center;
	}
	li.app-item{
		float:left;
		color:#AACC00;
		border-color:rgba(240, 240, 240, 0.75);
		border-style:solid;
		border-width:0px 1px 1px 0;
		box-sizing:border-box;
		width:33.3%;
		height:100%;
		display:inline-block;
		text-align:center;
		vertical-align:middle;
	}
	li.app-item .app-icon{
		width:1.407rem;
		height:1.407rem;
		border-radius:50%;
		margin:0.5rem auto 0.333rem;
	}
	li.app-item p{
		color:#9C9C9C;
		font-size:0.333rem;
		margin-bottom:0.5rem;
	}
</style>
<script type="text/javascript">
(function(){
	var appList = [{href:"#/networkset", icon:"internet", name:label.networkset},
				   {href:"#/guest", icon:"guest", name:label.guestNet},
				   {href:"#/parentCtrl", icon:"parent_ctrl", name:label.parentCtrl},
				   {href:"#/diagnose", icon:"diagnose", name:label.diagnose},
				   {href:"#/remoteMng", icon:"remote", name:label.remoteMng},
				   //{href:"#/timeZone", icon:"timezone", name:label.regionTimeZone},
				   {href:"#/wisp", icon:"wisp", name:label.wisp},
				   {href:"#/modifyPwd", icon:"lock", name:label.adminPwd},
				   {href:"#/lanSet", icon:"lan", name:label.lanSet},
				   //{href:"#/sysUpgrade", icon:"upgrade", name:label.sysUpgrade},
				   //{href:"#/adb", icon:"adb", name:"广告屏蔽", desc:"过滤网页和视频广告"},
				   {href:"#/light", icon:"led", name:label.ledTip},
				   {href:"javascript:void(0);", icon:"reboot", name:label.rebootRouter, id:"RebootRouter"},
				   {href:"javascript:void(0);", icon:"restore", name:label.reset, id:"FactoryReset"}];

	function initAppList(appList){
		var initApp = function(app){
			var id = "";
			if (app.id){
				id = 'id="' + app.id + '"';
			}

			var icon = "/luci-static/images/app-icon/" + app.icon + ".png?_=20170809165512";
			var appHtml = '<a href="' + app.href + '" ' + id + '>' +
							'<li class="app-item">' +
							'<img class="app-icon" src="' + icon + '" />' +
							'<p>' + app.name + '</p>' +
							'</li></a>';
			return $(appHtml);
		}

		var colNum = 3;
		var len = appList.length;
		var rowNum = Math.ceil(len / colNum);
		var idx = 0;
		var appCon = $("#AppList");

		for (var i = 0, idx = 0; i < rowNum; i++){
			var ul = $('<ul class="app-list"></ul>').appendTo(appCon);
			for (var j = 0; j < colNum && idx < len; j++, idx++){
				initApp(appList[idx]).appendTo(ul);
			}
		}
	}

	initAppList(appList);

	$("#RebootRouter").click(function(){
		showConfirm(label.routerReboot, function(choose){
			if (choose){
				showLoading(label.rebooting);
				$.sendAjax('/system/reboot', null, function(ret){
					$.setTimeout(function(){
						window.location.reload();
					}, ROUTER.time.reboot);

					$.setTimeout(function(){
						// 检测LAN是否可以连接DUT
						lanDetecting(function(){
							window.location.reload();
						});
					}, ROUTER.time.detectDelay);
				});
			}
		});
	});

	$("#FactoryReset").click(function(){
		showConfirm(label.routerReset, function(choose){
			if (choose){
				showLoading(label.rebooting);
				$.sendAjax('/system/reset', null, function(ret){
					$.setTimeout(function(){
						window.location.href = "http://" + "p.to";
					}, ROUTER.time.reset);

					$.setTimeout(function(){
						// 检测LAN是否可以连接DUT
						lanDetecting(function(){
							window.location.href = "http://" + "p.to";
						});
					}, ROUTER.time.detectDelay);
				});
			}
		});
	});
})();
</script>
<div class="head-con">
	<a href="javascript:logout();" class="head-btn-l">{%btn.logout%}</a>
	<h1 class="head-title">{%label.appSet%}</h1>
</div>
<div id="AppList" class="app-list"></div>